'use strict';

const Controller = require('egg').Controller;

class GroupController extends Controller {
    async index() {
        const {
            ctx
        } = this;
        ctx.body = 'hi, egg';
    }

    //看房
    async groupSee() {
        const {
            ctx
        } = this;
        const data = await this.app.mysql.select('groupseehouse');
        ctx.body = data;
    }

    //
    async addnum() {
        const {
            ctx
        } = this;
        const { id } = ctx.query;
        const data1 = await this.app.mysql.get('groupseehouse',{id});
        const result = await this.app.mysql.update('groupseehouse', {
            num:data1.num+1,type:2
        }, {
            where:{id}
        })
        const data = await this.app.mysql.select('groupseehouse');
        ctx.body = data;
        

    }
}

module.exports = GroupController;